<!-- * list -->
{capture name="list"}
	{assign var="sum_of_all_order_sums" value=0}
	{assign var="sum_of_all_item_counts" value=0}
	
	{counter start=0 skip=1 assign="ct"}

	{foreach from=$order_all item="el"}	
		{ext->class_function class="shop_cart" func="get_order_data" assign="elements" order_id=$el.order_id}
		{assign var="total_price" value=0}	
		{assign var="total_count" value=0}	
		{foreach from=$elements.products item="el3"}
			{foreach from=$el3.data item="el2" key="key2"}
				{if $el2.type=='custom_info'}
					{if $key2|truncate:6:"" != 'count_'}
						{capture name="custom_price"}count_{$key2}{/capture}
						{assign var="k_count" value=$smarty.capture.custom_price}
						{if $el3.data.$k_count}
							{math equation="x+y" x=$el3.data.$k_count.value y=$total_count|default:0 assign="total_count"}	
							{math equation="x*y+z" x=$el3.data.$k_count.value y=$el2.value z=$total_price|default:0 assign="total_price"}	
							{math equation="x+y" x=$total_price y=$all_total_price|default:0 assign="all_total_price"}	
						{/if}
					{/if}
				{/if}
			{/foreach}
		{/foreach}

	{counter skip=1 assign="ct"}
	{if $ct>=$page_data.current_page.from && $ct<=$page_data.current_page.to || $smarty.get.client_id}
	
	{math equation="x + y" x=$sum_of_all_order_sums y=$el.suma assign="sum_of_all_order_sums"}
	{math equation="x + y" x=$sum_of_all_item_counts y=$el.count assign="sum_of_all_item_counts"}
	
			{*debug var=$el*}
			<!-- * -->
			<table width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td height="1" bgcolor="#FFFFFF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				</tr>
			</table>
			<table width="100%" cellpadding="0" cellspacing="0" {if !$el.hide}bgcolor="#FDFDFD"{else}bgcolor="#F4F6F7"{/if} >
				<tr>			
					<td height="22" width="70" align="center" style="border-right:1px solid #D6DBDE"><input name="ids[{$el.order_id}]" value="{$el.order_id}" type="checkbox"></td>			
					<td width="150" align="center" style="border-right:1px solid #D6DBDE">{$el.date|date_format:"%Y%m%d"}{$el.order_id}</td>	
					<td width="130" align="center" style="border-right:1px solid #D6DBDE">{$el.date}</td>
					<td width="50" align="center" style="border-right:1px solid #D6DBDE">{$el.status} %</td>
					<td width="90" align="center" style="border-right:1px solid #D6DBDE">{$total_count}</td>
					<td width="110" align="center" style="border-right:1px solid #D6DBDE">{$total_price}</td>
					<td style="padding:0px 0px 0px 10px; border-right:1px solid #D6DBDE">
						<a href="index.php?admin=1&module=shop_cart&order_id={$el.order_id}{if $smarty.get.form_object_id}&form_object_id={$smarty.get.form_object_id}{/if}{if $smarty.get.client_id}&client_id={$smarty.get.client_id}{/if}{if $smarty.get.tpl_act==client_filter}&tpl_act=client_filter{/if}" class="blackNoUnderline">
							{t t='Užsakymo turinio peržiūra'}
						</a>
					</td>
					{ext->class_function class="shop_cart" module="statistic" assign="is_module"}
					{if $is_module == 1}
						{if !$el.is_in_stat}
						<td style="padding:0px 10px 0px 10px; border-right:1px solid #D6DBDE" width="150"><nobr>
							<a href="index.php?admin=1&module=shop_cart&parent={$el.order_id}&act=add_to_stat" class="blackNoUnderline">{t t='Įtraukti į statistiką'}</a>						
						</td>
						{else}
						<td style="padding:0px 10px 0px 10px; border-right:1px solid #D6DBDE" width="150"><nobr>
							<a href="index.php?admin=1&module=shop_cart&parent={$el.order_id}&act=remove_to_stat" class="blackNoUnderline">{t t='Neįtraukti į statistiką'}</a>						
						</td>
						{/if}
					{/if}
				</tr>
			</table>
			<table width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td height="1" bgcolor="#D6DBDE"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				</tr>
			</table>
			<!-- /* -->			
		{/if}			
	{/foreach}	
<!-- /* list -->
{/capture}

{include file="admin/modules/shop_cart/tabs.html"}
<form name="child_list" action="index.php" enctype="multipart/form-data" method="post">
<input name="admin" type="hidden" value="1">
<input name="module" type="hidden" value="shop_cart">
<input name="act" type="hidden" value="">
<input name="parent" type="hidden" value="">
<input name="status" type="hidden" value="">
<input name="referer" type="hidden" value="{ext->get_referer}">
<table width="100%" cellpadding="0" cellspacing="0" border="6" bordercolor="#DBE1E5" bgcolor="#DBE1E5">
<tr>
<td>
{if $smarty.get.client_id && $smarty.get.tpl_act=="client_filter"}
	{include file="admin/modules/shop_cart/menu_client.html"}
{else}
	{include file="admin/modules/shop_cart/menu.html"}
{/if}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="12"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
	<tr>
		<td height="1" bgcolor="#25404E"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>

{if $ct>0}
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
	<tr>		
		<td height="20" style="font-size:9px; color:#4C4C4C; text-align:center; border-right:1px solid #D6DBDE" width="70">{t t='Žymėjimas'}</td>	
		<td height="20" style="font-size:9px; color:#4C4C4C; text-align:center; border-right:1px solid #D6DBDE" width="150">{t t='Užsakymo ID'}</td>		
		<td height="20" style="font-size:9px; color:#4C4C4C; text-align:center; border-right:1px solid #D6DBDE" width="130">{t t='Data'}</td>		
		<td height="20" style="font-size:9px; color:#4C4C4C; text-align:center; border-right:1px solid #D6DBDE" width="50">{t t='Būsena'}</td>						
		<td height="20" style="font-size:9px; color:#4C4C4C; text-align:center; border-right:1px solid #D6DBDE" width="90">{t t='Prekių skaičius'}</td>						
		<td height="20" style="font-size:9px; color:#4C4C4C; text-align:center; border-right:1px solid #D6DBDE" width="110">{t t='Suma be nuolaidos'}</td>						
		<td style="font-size:9px; color:#4C4C4C; text-align:left; padding:0px 0px 0px 10px"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="1" bgcolor="#D6DBDE"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
{$smarty.capture.list}
{else}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="50" bgcolor="#FFFFFF" align="center" style="padding:15px">
		{t t='Nėra nei vieno užsakymo'}
		{if $smarty.get.form_object_id}.
		  <a href="index.php?admin=1" target="_self"><strong>{t t='Atkreipkite dėmesį, kad įjungtas filtravimas. Norėdami jį išjungti spauskite čia!'}</strong></a>
		{/if} 
		</td>		
	</tr>
</table>
{/if}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="1" bgcolor="#25404E"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>	
</table>
{if $smarty.get.client_id && $smarty.get.tpl_act=="client_filter" && $ct>0}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td style="padding:0 0 0 10px; background-color:#FFFFFF">
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td style="width:211px; border-right:1px solid #D6DBDE; height:20px;  ">{t t="Užsakymai"}: <strong>{$ct}</strong></td>		
				<td style="padding:0 0 0 10px; width:262px; border-right:1px solid #D6DBDE">{t t="Suma"}: <strong>{$sum_of_all_order_sums}</strong> {$_var.curency.default}</td>
				<td style="padding:0 0 0 10px;">{t t="Užsakyta prekių"}: <strong>{$sum_of_all_item_counts}</strong> </td>
			</tr>
		</table>
		</td>		
	</tr>
	<tr>
		<td height="1" bgcolor="#25404E"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>	
	<tr>
		<td height="12"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>	
</table>
{else}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="12"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>	
</table>
{/if}
{if $smarty.get.client_id && $smarty.get.tpl_act=="client_filter"}
	{include file="admin/modules/shop_cart/menu_client.html"}
{else}
	{include file="admin/modules/shop_cart/menu.html"}
{/if}
</td>		
</tr>
</table>
</form>